<!DOCTYPE html>
<html>

	<head>
		<style>
			body,
			html {
				background: #F4F4F4 !important;
			}
			
			.gouwuche {
				background: #FFFFFF !important;
			}
			
		</style>
		<link rel="stylesheet" href="<?php echo APP_TEMPLATES_URL;?>/css/checkbix.min.css" />
        <link rel="stylesheet" href="<?php echo APP_TEMPLATES_URL;?>/css/public.css" />
		<script src="<?php echo APP_TEMPLATES_URL;?>/js/checkbix.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			Checkbix.init();
		</script>
	</head>

	<body>
		<!-- 导航 -->
		<div class="mui-bar mui-bar-nav bj">
			<button class="mui-btn mui-btn-link mui-btn-nav mui-pull-left zys  mui-action-back">
				<img style=" max-width: 50%; vertical-align: middle;" src="<?php echo APP_TEMPLATES_URL;?>/images/back.png" />
			</button>
			<button class="mui-btn mui-btn-link mui-btn-nav mui-pull-right" style="margin-right: 15px;">
				<a href="index.php?act=cart&op=goods_cart&type=update">编辑</a>
			</button> &nbsp;
			<button class="mui-btn mui-btn-link mui-btn-nav mui-pull-right" style="margin-right: 20px;">
				<!--<a href="index.php?act=&op=">领劵</a>-->
			</button>
			<h1 class="mui-title"><label style="font-size: 22px;vertical-align: middle;">购物车</label></h1>
		</div>
		<!-- 主体内容 -->

		<script type="text/javascript">
			$(document).ready(function() {
				//jquery特效制作复选框全选反选取消(无插件)
				// 全选        
				$("#allselect").click(function() {

					if($(this).attr("checked")) {
						$(".gouwuche input[name=boxlist]").each(function() {
							$(this).attr("checked", true);
						});
						//$("#shuliang").text(<?php echo $output['cart_goods_num']?>);
						$("#zong").html((<?php echo $output['cart_all_price']?>).toFixed(2));
					} else {
						$(".gouwuche input[name=boxlist]").each(function() {
							$(this).attr("checked", false);
						});
						//$("#shuliang").text(0);
						$("#zong").html((0).toFixed(2));
					}
				});

				// 所有复选(:checkbox)框点击事件
				$(".gouwuche input[name=boxlist]").click(function() {
					if($(this).attr("checked")) {
						//$(this).next().css({ "background-color": "#3366cc", "color": "#ffffff" });
					} else {
						// $(this).next().css({ "background-color": "#ffffff", "color": "#000000" });
					}
					GetCount();
				});

				// 输出
				$(".gouwuche input[name=boxlist]").click(function() {
					GetCount();
				});
			});

			//******************
			/*
			 * 总数
			 */
			function GetCount() {
				var conts = 0;
				var temp = 0;
				$(".gouwuche input[name=boxlist]").each(function() {
					if($(this).attr("checked")) {
						for(var i = 0; i < $(this).length; i++) {
							conts += parseInt($(this).val());
							temp += 1;
						}
					}
				});
				//$("#shuliang").text(temp);
				$("#zong").html((conts).toFixed(2));
			}
			/*
			 * 改变一个商品数量改变价格
			 */
			function setTotal(thes) {
				var price = thes.parents().parents().find("#price").html();
				var number = thes.parents().parents().find(".number").html();

				var temp = (parseInt(price) * number).toFixed(2);
				thes.val(temp);
			}

			function goconfirm(){
				var t = [];
				$(".gouwuche input[name=boxlist]").each(function() {
					if($(this).attr("checked")){
						t.push($(this).attr("id"))
					}
				});
				if(t.toString()==''){
					alert("请选择商品!");
					return;
				}
				$("#cart_id").val(t.toString());
				$("#confirm_form").submit();
			}
		</script>

		<section>
			<!--                	
                	时间：2016-11-07
                	描述：分类
               -->
			<table width="100%">
				<?php foreach ($output['cart_list'] as $cart_info) { ?>
				<tr>
					<td colspan="3">
						<div style="height: 10px; background: #F4F4F4; clear: both;"></div>
					</td>
				</tr>

				<tr class="gouwuche">
					<td width="10" style="padding: 15px 10px 10px 10px;" class="veralignmiddle">
						<input id="<?php echo $cart_info['cart_id']; ?>|<?php echo $cart_info['goods_num']; ?>" type="checkbox" class="checkbix" checked data-shape="circled" name="boxlist" data-color="orange" data-text="" value="<?php echo $cart_info['goods_total_price']; ?>">
					</td>
					<td width="100" style="padding: 15px 0 10px 0;"><a href="index.php?act=goods&op=goods_detail&goods_id=<?php echo $cart_info['goods_id'];?>"><img style=" width: 100px; border: 1px solid #EEEEEE !important;" src="<?php echo cthumb($cart_info['goods_image'],265);?>" /></a></td>
					<td style="padding:12px 10px 10px 10px; vertical-align: top;">
						<p id="total2" class="cor666666 ft14 linkh22">
							<?php echo $cart_info['goods_name']; ?>
						</p>
						<p class="corbbbbbb ft13 marge20">金贵牌</p>
						<div>
							<span class="corc10a1f ft13">￥<label id="price" class="corc10a1f ft13"><?php echo $cart_info['goods_price']; ?></label></span>
							<span style="margin-left: 20px;" class="corefb33e ft13">年收益<?php echo $cart_info['year_rate']; ?>%</span>
							<span class="fr ft13">x<label class="number text_box2to"><?php echo $cart_info['goods_num']; ?></label></span>
						</div>
					</td>
				</tr>
				<?php } ?>

			</table>

			<div style="background: #F4F4F4;clear: both;"></div>
		</section>

		<!--
                	作者：569154771@qq.com
                	时间：2016-11-11
                	描述：去结算
                -->

		<style>
			.buttomcop {
				font-size: 18px;
				line-height: 70px;
				color: #000000;
				background: #f0b33e;
				float: left;
				text-align: center;
				width: 100%;
				margin-top: -1px;
			}
			
			.qujiesuan {
				background: #FFFFFF;
				position: fixed;
				bottom: 0px;
				width: 100%;
				border-top: 1px solid #EEEEEE;
			}
		</style>
		<div class="qujiesuan">
			<table width="100%">
				<tr>
					<td width="75" style="padding: 0px 0px 0px 10px;" class="veralignmiddle">
						<input name="allselectindex" type="hidden" value="false" />
						<input id="allselect" type="checkbox" class="checkbix" data-shape="circled" data-color="orange" data-text="" checked>
							<label for="allselect" style="vertical-align: top;font-size: 16px;">全选</label>
					</td>
					<td style="font-size: 13px; text-align: right;" class="veralignmiddle">
						<label class="cor666666">合计：</label>
						<label class="corc10a1f">￥<label id="zong" class="corc10a1f ft13"><?php echo $output['cart_all_price']?></label></label>
					</td>
					<td class="veralignmiddle" style="text-align: center;min-width: 50px;"><label class="cor666666 ft13">免运费</label></td>
					<td style="min-width: 70px;">
						<a class="buttomcop" href="javascript:void(0);" onclick="goconfirm()">去结算</a>
					</td>
				</tr>
			</table>
		</div>

<form id="confirm_form" method="post" action="index.php">
	<input id="act" name="act" type="hidden" value="order" />
	<input id="op" name="op" type="hidden" value="buy_step1" />
	<input id="cart_id" name="cart_id" type="hidden" value=""/>
	<input id="ifcart" name="ifcart" type="hidden" value="1" />
</form>
	</body>

</html>